﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using gds_classes;

namespace gds_make_public_key
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Public key creating app");
            Console.WriteLine("Enter your private key (0-{0}): ", GOST_Signification.q);

            int x = int.Parse(Console.ReadLine());

            if (x <= 0 || x >= GOST_Signification.q)
            {
                Console.WriteLine("Invalid private key");
                return;
            }

            int y = MathMethods.PowByMod(GOST_Signification.a, x, GOST_Signification.p);

            Console.WriteLine("Your public key is: {0}", y);
            Console.ReadLine();            
        }
    }
}
